﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace tao11.sdk
{
    internal static class Helper
    {
        public static void WriteJson(this System.Web.HttpResponse Response, object obj)
        {
            Response.ContentType = "application/json";
            Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
        }
        public static void WriteJson(this System.Web.HttpResponseBase Response, object obj)
        {
            Response.ContentType = "application/json";
            Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(obj));
        }
        static DateTime BaseTime= new DateTime(1970, 1, 1);
        public static int ToUnix(this DateTime dt)
        {
            return (int)(dt.Ticks - BaseTime.Ticks) / 10000000 - 8 * 60 * 60;
        }
    }
}
